import React, { useState, useEffect } from 'react'
import { Table } from 'antd'
import { getNavCategory } from './../../api/nav'
function NavigatorCategory() {
  const [ categorylist, setCategorylist ] = useState([])
  useEffect(() => {
    getNavCategory().then(res => {
      setCategorylist(res.data.data)
    })
  }, [])

  const columns = [
    {
      title: '序号',
      render: (text, record, index) => <span>{index + 1}</span>
    },
   
    {
      title: '名称',
      dataIndex: 'name',
      key: 'name'
    }
  ]
  return (
    <>
      <Table 
      dataSource={categorylist} 
      pagination={ false }
      rowKey = { record => record.categoryid }
      columns={columns} />
    </>
  )
}

export default NavigatorCategory